#pragma once
#include"protocol.hpp"

class NetCal
{
public:
    NetCal()
    {

    }

    ~NetCal()
    {

    }

    Response Cal(Request request)
    {
        int x = request.GetX();
        int y = request.GetY();
        char oper = request.GetOper();
        switch(oper)
        {
            case '+':
            return Response(x+y,0);
            break;
            case '-':
            return Response(x-y,0);
            break;
            case '*':
            return Response(x*y,0);
            break;
            case '/':
            if(y == 0)
            {
                return Response(-1,1);
            }
            else
            {
                return  Response(x/y,0);
            }
            break;
            default:
            return Response(-1,2);
            break;
        }
    }
};